﻿using System;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;

namespace Ecobee.Net
{
	/// <summary>
	/// The Schedule object defining the program schedule. 
	/// </summary>
	[JsonConverter(typeof(ScheduleConverter))]
	public class Schedule : ApiObject
	{
		#region Private Fields
		private string _name = string.Empty;
		private ScheduleTimeList _scheduleTimes = new ScheduleTimeList();
		#endregion

		[JsonIgnore]
		public override string UniqueKey
		{
			get
			{
				return this.Name;
			}
		}

		[JsonIgnore]
		public string Name
		{
			get
			{
				return _name;
			}
			set
			{
				_name= value;
			}
		}

		[JsonIgnore]
		public ScheduleTimeList ScheduleTimes
		{
			get
			{
				return _scheduleTimes;
			}
			set
			{
				_scheduleTimes= value;
			}
		}

		public override void LoadFrom(dynamic dataObject)
		{
			this.ScheduleTimes.Clear();
			base.LoadFrom((object)dataObject);
		}
	}
}
